Event.observe(window, 'load', page_loaded, false);

	function page_loaded(evt) {
	  Event.observe('mail', 'click', item_clicked, false);
  	  Event.observe('mail', 'mouseover', item_mouseover, false);
  	  Event.observe('mail', 'mouseout', item_mouseout, false);
	  
	}
	
	function item_mouseout(evt){
		var row = Event.findElement(evt, 'tr');
		var msgid = row.id.gsub('msg-','');
		$(row.id).toggleClassName('mail-status-mouseover');                
		Event.stop(evt); //avoid another call related to 'mail' itself
	}
	
	function item_mouseover(evt){
		var row = Event.findElement(evt, 'tr');
		var msgid = row.id.gsub('msg-','');
		$(row.id).toggleClassName('mail-status-mouseover');        
		Event.stop(evt); //avoid another call related to 'mail' itself
	}
	
	function item_clicked(evt){
		var row = Event.findElement(evt, 'tr');
		var msgid = row.id.gsub('msg-','');
        window.location= '/mail/view/id/' +  msgid;
		Event.stop(evt); //avoid another call related to 'mail' itself
	}